home *** CD-ROM | disk | FTP | other *** search
/ Champak 128 / Vol 128 (Damaged).iso / games / fire_it_.swf / scripts / __Packages / #27.as < prev    next >
Encoding:
Text File  |  2011-03-26  |  5.2 KB  |  194 lines

  1. class ┬º#27┬º
  2. {
  3.    static var ┬º#3┬º = false;
  4.    function ┬º#27┬º(context)
  5.    {
  6.       this["#34"] = false;
  7.       this["#192"] = 1;
  8.       this["#17"] = new Sound(context);
  9.    }
  10.    function ┬º#2┬º()
  11.    {
  12.       return "SoundWrapper (" + this.name + "):  ";
  13.    }
  14.    function loadSound(┬º#288┬º, name, volume, offset, ┬º#120┬º)
  15.    {
  16.       this.name = name;
  17.       if(volume == undefined)
  18.       {
  19.          volume = 100;
  20.       }
  21.       this["#28"] = volume;
  22.       this["#22"] = volume;
  23.       this["#17"]["#43"] = this;
  24.       this["#17"].onLoad = function(success)
  25.       {
  26.          if(success)
  27.          {
  28.             this["#43"].setVolume(this["#43"]["#28"]);
  29.             if(offset != undefined)
  30.             {
  31.                this["#43"].start(offset,eval("#120"));
  32.             }
  33.             this["#43"].onLoad();
  34.          }
  35.          else
  36.          {
  37.             eval("#0").log("failed to load " + this["#43"]);
  38.          }
  39.       };
  40.       this["#17"].onSoundComplete = function()
  41.       {
  42.          if(eval("#27")["#3"])
  43.          {
  44.             eval("#0").log(this["#43"] + " complete");
  45.          }
  46.          this["#43"]["#34"] = false;
  47.          this["#43"].onSoundComplete();
  48.       };
  49.       this["#17"].loadSound(┬º#288┬º + "/" + name,false);
  50.    }
  51.    function attachSound(name, volume, offset, ┬º#120┬º)
  52.    {
  53.       this.name = name;
  54.       this["#17"].attachSound(name);
  55.       if(volume == undefined)
  56.       {
  57.          volume = 100;
  58.       }
  59.       this["#28"] = volume;
  60.       this["#22"] = volume;
  61.       this["#17"].setVolume(volume);
  62.       if(offset != undefined)
  63.       {
  64.          this["#17"].start(offset,┬º#120┬º);
  65.       }
  66.       this["#17"]["#43"] = this;
  67.       this["#17"].onSoundComplete = function()
  68.       {
  69.          if(eval("#27")["#3"])
  70.          {
  71.             eval("#0").log(this["#43"] + " complete");
  72.          }
  73.          this["#43"]["#34"] = false;
  74.          this["#43"].onSoundComplete();
  75.       };
  76.       if(eval("#27")["#3"])
  77.       {
  78.          eval("#0").log(this["#2"]() + "attached " + this.toString());
  79.       }
  80.    }
  81.    function start(offset, ┬º#120┬º)
  82.    {
  83.       if(eval("#27")["#3"])
  84.       {
  85.          eval("#0").log(this["#2"]() + "starting " + this.toString() + ", " + ┬º#120┬º + " loops");
  86.       }
  87.       this["#34"] = true;
  88.       this["#17"].start(offset,┬º#120┬º);
  89.       if(this["#22"] != this["#28"])
  90.       {
  91.          this["#131"] = _global.setInterval(this,"#167",100);
  92.       }
  93.    }
  94.    function stop()
  95.    {
  96.       if(eval("#27")["#3"])
  97.       {
  98.          eval("#0").log(this["#2"]() + "stopping " + this.toString());
  99.       }
  100.       this["#34"] = false;
  101.       this["#17"].stop();
  102.    }
  103.    function getVolume()
  104.    {
  105.       return this["#28"];
  106.    }
  107.    function setVolume(volume)
  108.    {
  109.       if(eval("#27")["#3"])
  110.       {
  111.          eval("#0").log(this["#2"]() + "setting volume to " + volume);
  112.       }
  113.       this["#28"] = volume;
  114.       this["#22"] = volume;
  115.       this["#17"].setVolume(volume);
  116.    }
  117.    function ┬º#64┬º(┬º#28┬º, time, ┬º#228┬º)
  118.    {
  119.       if(┬º#28┬º < 0)
  120.       {
  121.          eval("#0").log(this["#2"]() + "bad fade target " + ┬º#28┬º + ", setting to 0");
  122.          ┬º#28┬º = 0;
  123.       }
  124.       else if(┬º#28┬º > 100)
  125.       {
  126.          eval("#0").log(this["#2"]() + "bad fade target " + ┬º#28┬º + ", setting to 100");
  127.          ┬º#28┬º = 100;
  128.       }
  129.       if(eval("#27")["#3"])
  130.       {
  131.          eval("#0").log(this["#2"]() + "fading " + this.toString() + "\'s volume to " + ┬º#28┬º + " over " + time + "#476");
  132.       }
  133.       this["#22"] = this["#17"].getVolume();
  134.       this["#28"] = ┬º#28┬º;
  135.       var _loc3_ = ┬º#28┬º - this["#22"];
  136.       this["#192"] = Math.abs(_loc3_ / time * 250);
  137.       if(!this["#34"])
  138.       {
  139.          this["#34"] = true;
  140.          this["#17"].start();
  141.       }
  142.       this["#228"] = ┬º#228┬º;
  143.       clearInterval(this["#131"]);
  144.       this["#131"] = setInterval(this,"#167",250);
  145.       this["#167"]();
  146.    }
  147.    function ┬º#167┬º()
  148.    {
  149.       if(!this["#34"])
  150.       {
  151.          clearInterval(this["#131"]);
  152.       }
  153.       if(this["#22"] < this["#28"])
  154.       {
  155.          this["#22"] += this["#192"];
  156.          if(this["#22"] > this["#28"])
  157.          {
  158.             this["#22"] = this["#28"];
  159.          }
  160.       }
  161.       else
  162.       {
  163.          this["#22"] -= this["#192"];
  164.          if(this["#22"] < this["#28"])
  165.          {
  166.             this["#22"] = this["#28"];
  167.          }
  168.       }
  169.       if(eval("#27")["#3"])
  170.       {
  171.          eval("#0").log(this["#2"]() + "targetVolume = " + this["#28"] + ", fadeVolume = " + this["#22"]);
  172.       }
  173.       this["#17"].setVolume(this["#22"]);
  174.       if(this["#22"] == this["#28"])
  175.       {
  176.          clearInterval(this["#131"]);
  177.          if(this["#228"])
  178.          {
  179.             this.stop();
  180.          }
  181.       }
  182.    }
  183.    function toString()
  184.    {
  185.       var _loc2_ = "[SoundWrapper name: \"" + this.name + "\"" + ", volume: " + this["#17"].getVolume() + "/" + this["#28"] + ", pan: " + this["#17"].getPan() + ", duration: " + this["#17"].duration + ", position: " + this["#17"].position;
  186.       if(this["#17"].getBytesLoaded() != undefined)
  187.       {
  188.          _loc2_ += ", bytes: " + this["#17"].getBytesLoaded() + "/" + this["#17"].getBytesTotal();
  189.       }
  190.       _loc2_ += "]";
  191.       return _loc2_;
  192.    }
  193. }
  194.